<script>
import MAIN_STORE from '@/store/store.js'
import DecisionFutu from './modules/decision-futu.vue'
import DecisionPengz from './modules/decision-pengz.vue'
import DecisionConnect from './modules/decision-connect.vue'
import DecisionClearDistance from './modules/decision-clear-distance.vue'
import DecisionDuanmian from './modules/decision-duanmian.vue'
export default {
  /**
   * 图层工具方法
   * 距离量算 面积量算 标注 属性查询
  */
  name: "layer-tool-decision",
  components: {
    DecisionFutu,
    DecisionPengz,
    DecisionConnect,
    DecisionClearDistance,
    DecisionDuanmian
  },
  data() {
    return {
      visibleFutu: false,
      visiblePengz: false,
      visibleConnect: false,
      visibleClearDistance: false,
      visibleDuanmian: false
    }
  },
  computed: {
  },
  watch: {
  },
  mounted() {
  },
  beforeUnmount() {
  },
  methods: {
    closeDecisionAll() {
      document.getElementById('holder-element').focus();
      this.visibleFutu = false;
      this.visiblePengz = false;
      this.visibleConnect = false;
      this.visibleClearDistance = false;
      this.visibleDuanmian = false
    }
  },
};
</script>

<template>
  <div class="layer-tool-container" :class="[
    ['Search', 'Decision'].indexOf($route.name) !== -1 ? 'show' : ''
  ]">
    <div class="layer-tool-group">
      <!-- <div class="layer-tool-item">
        <div class="icon">
          <i class="iconfont-pipe icon-pipe-jiemian"></i>
        </div>
        <span class="title font-alimamashuheiti">断面分析</span>
      </div> -->

      <el-popover tabindex="-1" :visible="visibleDuanmian" placement="right-start" :width="300" trigger="click">
        <template #reference>
          <div class="layer-tool-item" @click="() => { visibleDuanmian = true; }">
            <div class="icon">
              <i class="iconfont-pipe icon-pipe-jiemian"></i>
            </div>
            <span class="title font-alimamashuheiti">断面分析</span>
          </div>
        </template>
        <div class="">
          <decision-duanmian :visible="visibleDuanmian" @close="closeDecisionAll" />
        </div>
      </el-popover>

      <el-popover tabindex="-1" :visible="visibleClearDistance" placement="right-start" :width="550" trigger="click">
        <template #reference>
          <div class="layer-tool-item" @click="() => { visibleClearDistance = true; }">
            <div class="icon">
              <i class="iconfont-pipe icon-pipe-jingju"></i>
            </div>
            <span class="title font-alimamashuheiti">净距分析</span>
          </div>
        </template>
        <div class="">
          <decision-clear-distance :visible="visibleClearDistance" @close="closeDecisionAll" />
        </div>
      </el-popover>

      <el-popover tabindex="-1" :visible="visiblePengz" placement="right-start" :width="550" trigger="click">
        <template #reference>
          <div class="layer-tool-item" @click="() => { visiblePengz = true; }">
            <div class="icon">
              <i class="iconfont-pipe icon-pipe-pengzhuang"></i>
            </div>
            <span class="title font-alimamashuheiti">碰撞分析</span>
          </div>
        </template>
        <div class="">
          <decision-pengz :visible="visiblePengz" @close="closeDecisionAll" />
        </div>
      </el-popover>

      <el-popover tabindex="-1" :visible="visibleFutu" placement="right-start" :width="550" trigger="click">
        <template #reference>
          <div class="layer-tool-item" @click="() => { visibleFutu = true; }">
            <div class="icon">
              <i class="iconfont-pipe icon-pipe-futushendu"></i>
            </div>
            <span class="title font-alimamashuheiti">覆土深度</span>
          </div>

        </template>
        <div class="">
          <decision-futu :visible="visibleFutu" @close="closeDecisionAll" />
        </div>
      </el-popover>

      <el-popover tabindex="-1" :visible="visibleConnect" placement="right-start" :width="350" trigger="click">
        <template #reference>
          <div class="layer-tool-item" @click="() => { visibleConnect = true; }">
            <div class="icon">
              <i class="iconfont-pipe icon-pipe-liantong"></i>
            </div>
            <span class="title font-alimamashuheiti">连通分析</span>
          </div>
        </template>
        <div class="">
          <decision-connect :visible="visibleConnect" @close="closeDecisionAll" />
        </div>
      </el-popover>
    </div>
  </div>
</template>
<style lang="less" scoped>
.layer-tool-container {
  pointer-events: all;
  position: fixed;
  width: 6rem;
  top: 11rem;
  left: 10rem;
  display: none;

  &.show {
    display: initial;
  }

  &>.layer-tool-group {
    background-color: #fff;
    box-shadow: 0 0 0 0.5rem rgba(255, 255, 255, 0.2);

    &>.layer-tool-item {
      cursor: pointer;
      height: 6rem;
      text-align: center;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      transition: all .3s;

      &:not(:last-of-type) {
        border-bottom: 1px dashed #afafaf;
      }

      &:hover {
        background-color: rgba(33, 104, 178, .2);

        &>span {
          color: #2168b2;
        }
      }

      &>.icon {
        font-size: 2.4rem;
        color: #2168b2;
      }

      &>span {
        font-size: 1.2rem;
      }
    }
  }
}
</style>